package com.hzlj.position.locate.converter;

import com.fz.common.base.converter.ModelDTOConverter;
import com.fz.common.base.core.date.DateUtils;
import com.hzlj.position.locate.common.dto.abnGatheringJzry.AbnGatheringJzryAddDTO;
import com.hzlj.position.locate.common.dto.abnGatheringJzry.AbnGatheringJzryQueryResultDTO;
import com.hzlj.position.locate.common.model.AbnGatheringJzry;

/**
 * 定位分析-聚众告警表-定位信息(AbnGatheringJzry)DTO转换类
 *
 * @author lifh
 * @date 2023-03-28 10:20:23
 */
public class AbnGatheringJzryConverter {
    /**
     * model实例转换为查询结果DTO
     *
     * @param model model实例
     * @return DTO
     */
    public static AbnGatheringJzryQueryResultDTO from(AbnGatheringJzry model) {
        return ModelDTOConverter.from(model, AbnGatheringJzryQueryResultDTO.class);
    }

    /**
     * 新增DTO转换为model实例
     *
     * @param dto 新增DTO
     * @return model实例
     */
    public static AbnGatheringJzry from(AbnGatheringJzryAddDTO dto) {
        return ModelDTOConverter.from(dto, AbnGatheringJzry.class, (AbnGatheringJzry l) -> {
            l.setUpdateTime(DateUtils.now());
            l.setCreateTime(DateUtils.now());
        });

    }

}
